Dynamic memory protection

ABSTRACT

Aspects of the present disclosure relate to protecting the contents of memory in an electronic device, and in particular to systems and methods for transferring data between memories of an electronic device in the presence of strong magnetic fields. In one embodiment, a method of protecting data in a memory in an electronic device includes storing data in a first memory in the electronic device; determining, via a magnetic sensor, a strength of an ambient magnetic field; comparing the strength of the ambient magnetic field to a threshold; transferring the data in the first memory to a second memory in the electronic device upon determining that the strength of the ambient magnetic field exceeds the threshold; and transferring the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.

INTRODUCTION

Aspects of the present disclosure relate to protecting the contents of memory in an electronic device, and in particular to systems and methods for transferring data between memories of an electronic device in the presence of strong magnetic fields.

Electronic devices generally include a memory for storing and manipulating data in concert with a processor. As electronic devices get smaller, faster, and more capable, the demands on the core components of the devices, such as the memory, grow accordingly. For example, electronic devices are evolving to use lower power memory technologies (and others) in order to extend their operational capabilities.

Magnetoresistive random access memory (MRAM) is one such technology that is evolving to provide increased performance, which leads to new applications of the technology, such as in body-implantable devices (e.g., within a human body). However, because such implantable devices may not be easily separated from the body in which they reside, the implantable devices may be subjected to certain environmental conditions that are detrimental to their performance, such as strong magnetic fields. For example, if a human host of an implantable device needs to undergo a magnetic resonance imaging (MRI) scan, the magnetic-based memory may lose its content by the strong magnetic fields created by the MRI machine. For life-critical applications (e.g., pacemakers), this presents a significant problem that may prevent such magnetic-based memories from being used in implantable devices—or any other electronic devices that may experience strong magnetic field environments. This is particularly unfortunate when a magnetic-based memory may otherwise be the best performance option for the device.

Accordingly, there is a need for systems and methods to implement magnetic-based memory technologies in electronic devices that may be subjected to strong magnetic fields.

BRIEF SUMMARY

Certain embodiments provide a method of protecting data in a memory in an electronic device, including: storing data in a first memory in the electronic device; determining, via a magnetic sensor, a strength of an ambient magnetic field; comparing the strength of the ambient magnetic field to a threshold; transferring the data in the first memory to a second memory in the electronic device upon determining that the strength of the ambient magnetic field exceeds the threshold; and transferring the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.

Other embodiments provide an electronic device, including: a first memory; a second memory; a magnetic sensor; and a processor in data communication with the first memory, the second memory, and the magnetic sensor and configured to: store data in the first memory; determine, via the magnetic sensor, a strength of an ambient magnetic field; compare the strength of the ambient magnetic field to a threshold; transfer the data in the first memory to a second memory upon determining that the strength of the ambient magnetic field exceeds the threshold; and transfer the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.

Other embodiments provide a non-transitory, computer-readable medium comprising instructions that, when executed by a processor of an electronic device, cause the electronic device to perform a method of protecting data in a memory in an electronic device, the method comprising: storing data in a first memory in the electronic device; determining, via a magnetic sensor, a strength of an ambient magnetic field; comparing the strength of the ambient magnetic field to a threshold; transferring the data in the first memory to a second memory in the electronic device upon determining that the strength of the ambient magnetic field exceeds the threshold; and transferring the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.

The following description and the related drawings set forth in detail certain illustrative features of one or more embodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

The appended figures depict certain aspects of the one or more embodiments and are therefore not to be considered limiting of the scope of this disclosure.

FIG. 1 depicts a method of protecting data in a memory in an electronic device.

FIG. 2 depicts an electronic device configured to protect data in its memory.

FIG. 3 depicts an example processing system.

To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the drawings. It is contemplated that elements and features of one embodiment may be beneficially incorporated in other embodiments without further recitation.

DETAILED DESCRIPTION

Aspects of the present disclosure provide methods and apparatuses for protecting the contents of memory in an electronic device, in particular for transferring data between memories of an electronic device in the presence of strong magnetic fields.

The following description provides examples, and is not limiting of the scope, applicability, or embodiments set forth in the claims. Changes may be made in the function and arrangement of elements discussed without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. For instance, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Also, features described with respect to some examples may be combined in some other examples. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the disclosure is intended to cover such an apparatus or method that is practiced using other structure, functionality, or structure and functionality in addition to, or other than, the various aspects of the disclosure set forth herein. It should be understood that any aspect of the disclosure disclosed herein may be embodied by one or more elements of a claim.

Implantable electronic devices (e.g., medical devices implanted into a human body) have become far more capable and practical as a byproduct of improved electronic technologies, such as improved memory technologies that both store more data in a smaller size and use less power while doing so. An emerging low-power, high-performance memory technology is magnetoresistive random access memory (MRAM). While magnetic-based memories are not new, new architectures for magnetic-based memory are emerging that offer significant performance improvements over existing technologies.

For example, Spin-Transfer Torque (STT) MRAM is a new, non-volatile magnetic-based RAM architecture that is well-suited for many electronic device applications because it delivers the high-performance of existing memory technologies, like dynamic random-access memory (DRAM) and static random-access memory (SRAM), while offering additional benefits, such as low power, endurance, space efficiency, and scalability. For example, STT-MRAM does not require a power-refresh like DRAM, and the read process is not destructive, which collectively leads to lower power use and latency in the electronic device. As another example, STT-MRAM cells generally use one transistor as compared to the four or six transistors in a typical SRAM, which saves space and power in operation. Further, STT-MRAM scales well with decreasing device sizes and is compatible with existing CMOS manufacturing processes. This and other technological developments to STT-MRAM make it an ideal replacement for SRAM, DRAM, and NOR-flash in electronic devices. Thus, STT-MRAM is an excellent candidate for implantable electronic devices where size, power efficiency, and capability are all at a premium.

Generally, an MRAM memory cell includes a magnetic tunnel junction (MTJ) for sensing the state of a memory cell. A recent development in MRAM technology is called the Perpendicular MTJ (pMTJ), where the magnetic moments are perpendicular to the silicon substrate surface. pMTJ-based STT-MRAM scales with smaller device sizes better than earlier versions of STT-MRAM, which, for example, used an in-plane MTJ (TMTJ).

While generally non-volatile, magnetic-based memories like STT-MRAM are sensitive to certain environmental conditions, such as strong magnetic fields. pMTJ based STT-MRAM may generally be immune to magnetic fields up to a strength (i.e., intensity) of 1,500 Oersteds (Oe), but may risk data loss in more intense magnetic field environments. As such, an STT-MRAM may risk data corruption or loss in the proximity of certain machinery, like a magnetic resonance imaging (MRI) machine. For example, many MRI systems operate at around 15,000 Oe (1.5 T), but commercial systems are generally available between 2,000 Oe (0.2 T) and 70,000 Oe (7 T). Moreover, the strength of the magnetic field around an MRI may be as high as 300-400 Oe (40 mT) when the MRI is not in use because the superconducting magnets within an MRI machine are generally never turned off. And even though MRIs are generally magnetically shielded, the magnetic shielding does not perfectly shield the field generated by the MRI. Thus, the strength of the magnetic fields produced by an MRI (or any other machinery that creates strong magnetic fields) may easily corrupt data in a magnetic-based memory, such as STT-MRAM.

Because an implantable device is not easily removed, a solution is necessary for STT-MRAM to be usable in implantable devices. One solution to the problem of using magnetic-based memories in implantable devices (and other electronic device), which may experience strong magnetic fields, is to offload (e.g., by transferring) data from a magnetic-based memory (e.g., STT-MRAM) to a non-magnetic-based memory (e.g., SRAM) when the electronic device enters a strong magnetic field. In particular, by sensing the strength of an ambient magnetic field, measured for example in Oersteds (Oe), an electronic device may move the data from the magnetic-based memory to a secondary memory prior to reaching a strength that may corrupt the memory. Thus, a process may be undertaken within the electronic device to preserve the contents of the magnetic-based memory while experiencing a strong magnetic field. Subsequently, when the electronic device moves out of the strong magnetic field, the data may be moved back from the second memory to the magnetic-based memory in order to continue utilizing the benefits of the magnetic-based memory (e.g., lower power use).

Example Methods and Systems for Dynamically Protecting Memory

FIG. 1 depicts a method 100 of protecting data in a memory in an electronic device. The method 100 beings at step 102 where data is stored in a first memory in the electronic device. The data may be, for example, software, user data, operational data, sensor data, or any other sort of data stored in the electronic device. In some embodiments, the first memory may be a magnetoresistive random-access memory (MRAM), such as a Spin-Transfer Torque (STT) MRAM (STT-MRAM). In some embodiments, the STT-MRAM is a perpendicular magnetic tunnel junction (PMTJ) based STT-MRAM.

The method 100 then proceeds to step 104 where a strength of an ambient magnetic field is determined via a magnetic sensor. In some embodiments, the magnetic sensor is a tunnel-magnetoresistance (TMR) sensor.

The method 100 then proceeds to step 106 where the strength of the ambient magnetic field is compared to a threshold. In some embodiments, the threshold is in the range of 300 to 500 oersted (Oe). For example, the threshold may be 300 Oe, 400 Oe, 500 Oe, or other specific values within the range of 300 to 500 Oe. Other thresholds are possible.

The method 100 then proceeds to step 108 where the data in the first memory is transferred to a second memory upon determining that the strength of the ambient magnetic field exceeds the threshold. For example, the data may be moved or copied or otherwise transferred to the second memory via a data bus connecting the first memory and the second memory. In some embodiments, the second memory may be a dynamic random-access memory (DRAM), a static random-access memory (SRAM), a flash memory, or any other sort of memory that is resistant to strong magnetic fields.

The method 100 then proceeds to step 110 where the first memory is disabled upon determining that the strength of the ambient magnetic field exceeds the threshold. For example, the memory may be deactivated or turned off by appropriate circuit elements or it may simply be unmounted or otherwise ignored via firmware or software. In other examples, the first memory may be left enabled, but may not be used (e.g., accessed or stored to) during the time that the ambient magnetic field exceeds the threshold.

The method 100 then proceeds to step 112 where the data is accessed by a processor while the data is stored in the second memory. For example, the processor may continue to execute instructions (e.g., firmware or software) based on the data stored in the second memory while the first memory is disabled or otherwise not being used. In this way, the electronic device is able to continue operating normally while the first memory, which may be a primary memory of the electronic device, is unavailable. The processor may continue to create and store new data to the second memory while the first memory is unavailable. Because the second memory may have to act as a complete backup of the first memory, in some embodiments the second memory is at least the same size as the first memory (i.e., has at least the same capacity). Thus, the electronic device may continue to function normally despite the first memory being unavailable.

The method 100 then proceeds to step 114 where the data is transferred from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold. The data that is transferred back may be the exact same data as transferred to the second memory, or in some cases may be a different set of data. For example, where the electronic device continues to operate normally after the transfer of data, the electronic device may create new data (e.g., operational data) that is stored in the second memory and then subsequently transferred back to the first memory. Thus, the content of the data stored in the second memory may change while the first memory is unavailable and the entire content of the second memory may subsequently be transferred back to the first memory.

Further, in this example, the same threshold triggers transferring the data either to the second memory from the first memory, or back to the first memory from the second memory. However, in some examples more than one threshold may be used (e.g., a transfer out of the first memory threshold and a transfer into the first memory threshold) in order to avoid excessive memory transfer operations when the electronic device is located in an area where the magnetic field is fluctuating above and below the threshold, or when the device is moving in an out of a threshold level magnetic field. Thus, in some cases the threshold may have hysteresis properties to avoid the unnecessary switching.

FIG. 2 depicts an electronic device 200 configured to protect data in its memory. Electronic device 200 includes a magnetic sensor 202. Magnetic sensor 202 may be any sort of magnetometer or magnetoresistive transducers that may measure at least the strength of a magnetic field, and may additionally be capable of measuring the direction or relative change of a magnetic field at a particular location. In some embodiments, magnetic sensor 202 may be a Hall Effect sensor, an anisotropic magnetoresistance (AMR) sensor, a giant magnetoresistance (GMR) sensor, a tunneling magnetoresistance (TMR) sensor, or other types of magnetic sensor. Note that term magnetic tunnel junction (MTJ) may be used to refer to a TMR sensing element.

A TMR sensor may be a preferred sensor for the electronic device. Relative to a Hall Effect sensor, a TMR sensor has better temperature stability, higher sensitivity, lower power consumption, better linearity, and needs no additional flux concentrator structure. Relative to an AMR sensor, a TMR sensor has better temperature stability, higher sensitivity, and a wider linear range. And relative to a GMR sensor, a TMR sensor has better temperature stability, higher sensitivity, lower power consumption, and a wider linear range. Further, a TMR sensor generally has the smallest die size of all the aforementioned sensor types. This characteristic is particularly important for implantable electronic devices since space is very limited in such applications.

Generally, a TMR sensing element may include a pinned ferromagnetic layer, a tunnel barrier layer, and a free ferromagnetic layer. The pinned ferromagnetic layer may be a composite layer formed of an anti-ferromagnetic pinning layer and a ferromagnetic layer. Or the pinned layer could be an alloy with high coercivity. The tunnel barrier layer is generally made of MgO or AlOx. The ferromagnetic layer is “free” because there is no “pinning layer” as there is with the pinned ferromagnetic layer. The pinned layer magnetization direction is relatively fixed in the presence of modest magnetic fields. The free layer magnetization direction is relatively easy to rotate in modest magnetic fields. The TMR sensing element may further include a bottom conducting layer and a top conducting layer that are in direct electrical contact with the anti-ferromagnetic layer, and the free layer, respectively. The top and bottom conductive (i.e., electrode) layers may be formed of a non-magnetic conductive material and may carry input current through the tunnel junction and to meters that measure the current (or voltage). The bottom conducting layer may be supported by an insulating layer. Further, a substrate may be located beneath all of the other layers.

Electronic device 200 also includes a first memory 204. As discussed above with respect to FIG. 1, in some embodiments, the first memory may be a magnetic-based memory. For example, the first memory may be a STT-MRAM, such as a PMTJ-based STT-MRAM. In other embodiments, the first memory may be a ferroelectric RAM (e.g., FeRAM, F-RAM, or FRAM).

Electronic device 200 also includes a second memory 206. As discussed above with respect to FIG. 1, in some embodiments, the second memory may be non-magnetic-based memory. For example, the second memory may be a volatile memory, such as dynamic random-access memory (DRAM), a double data rate synchronous dynamic random-access memory (DDR SDRAM), a static random-access memory (SRAM), a quad data rate (QDR) SRAM, and others. Or the second memory may be a non-volatile memory, such as non-volatile random-access memory (NVRAM) (e.g., flash memory), non-volatile SRAM (nvSRAM), phase-change memory (e.g., PRAM), conductive-bridging RAM (CBRAM), resistive random-access memory (RRAM or ReRAM), Nano-RAM (NRAM), and others.

Electronic device 200 also includes cache 210. Cache 210 may be, for example, a memory reserved for use of processor 212 to process data and move data. For example, as described above, the data within first memory 204 may be moved to second memory 206 when electronic device 200 detects a strong magnetic field. In some examples, the contents may be moved between memories by way of cache 210. In other examples, cache 210 may simply be a high-speed local working memory for use by processor 212.

Electronic device 200 also includes processor 212. Processor 212 may be any sort of processor capable of executing executable instructions. For example, processor 212 may be configured to perform the steps described with respect to FIG. 1, above. By way of example, processor 212 may receive magnetic sensor data from magnetic sensor 202 and may compare the data (e.g., including an indication of a strength of a magnetic field) to a threshold. If the strength of the magnetic field exceeds the threshold, processor 212 may initiate a transfer of data from first memory 204 to second memory 206. In some examples, the transfer may be directly between first memory 204 and 206 via common data bus 208. In other examples, processor 212 may use cache 210 while transferring data from first memory 204 to second memory 206. In yet other examples, a dedicated data channel may run between first memory 204 and second memory 206 (as depicted by the broken line between the two), which facilitates rapid transfer of the data between the two memories without the normal contention on data bus 208.

Electronic device 200 also includes data bus 208, which may provide a data connection between all aspects of electronic device 200. Though shown as a single data bus in FIG. 2, electronic device 200 may include a plurality of data buses.

Electronic device 200 may also include a housing 214. The housing may envelop magnetic sensor 202, first memory 204, second memory 206, data bus 208, cache 210, and processor 212, among other things. In some embodiments, housing 214 may be a bio-compatible substances, such as certain plastics, polymers, or metals that may be implanted within a body. For example, bio-compatible plastics may include polyvinylchloride, polyethersulfone, polytetrafluoroethylene, polyethylene, polyurethane, polyetherimide, polycarbonate, polysulfone, polyetheretherketone, polypropylene, and others. Biocompatible plastics may include, for example, stainless steel, CoCr alloys, Ti alloys, and others.

FIG. 3 depicts an example processing system 300 configured to perform aspects described herein. Processing system 300 includes a processor 302 in data communication with a computer-readable medium 304. Computer-readable medium 304 includes a variety of components, including a storing component 306, a determining component 308, a comparing component 310, a transferring component 312, a disabling component 314, and an accessing component 316. Notably, in other embodiments, computer-readable medium 304 may include more or fewer components.

Storing component 306 may be configured to or otherwise provide a means to, for example, store data in one or more memories, such as described above with respect to FIG. 1.

Determining component 308 may be configured to or otherwise provide a means to, for example, determine a strength of a magnetic field, such as described above with respect to FIG. 1.

Comparing component 310 may be configured to or otherwise provide a means to, for example, compare a determined strength of the magnetic field to a threshold, such as described above with respect to FIG. 1.

Transferring component 312 may be configured to or otherwise provide a means to, for example, transfer data from at least a first memory to at least a second memory, such as described above with respect to FIG. 1.

Disabling component 314 may be configured to or otherwise provide a means to, for example, disable a memory of an electronic device, such as described above with respect to FIG. 1.

Accessing component 316 may be configured to or otherwise provide a means to, for example, access data stored in one or more memories, such as described above with respect to FIG. 1.

The preceding description is provided to enable any person skilled in the art to practice the various embodiments described herein. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments. For example, changes may be made in the function and arrangement of elements discussed without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. Also, features described with respect to some examples may be combined in some other examples. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the disclosure is intended to cover such an apparatus or method that is practiced using other structure, functionality, or structure and functionality in addition to, or other than, the various aspects of the disclosure set forth herein. It should be understood that any aspect of the disclosure disclosed herein may be embodied by one or more elements of a claim.

As used herein, the word “exemplary” means “serving as an example, instance, or illustration.” Any aspect described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects.

As used herein, a phrase referring to “at least one of” a list of items refers to any combination of those items, including single members. As an example, “at least one of: a, b, or c” is intended to cover a, b, c, a-b, a-c, b-c, and a-b-c, as well as any combination with multiples of the same element (e.g., a-a, a-a-a, a-a-b, a-a-c, a-b-b, a-c-c, b-b, b-b-b, b-b-c, c-c, and c-c-c or any other ordering of a, b, and c).

As used herein, the term “determining” encompasses a wide variety of actions. For example, “determining” may include calculating, computing, processing, deriving, investigating, looking up (e.g., looking up in a table, a database or another data structure), ascertaining and the like. Also, “determining” may include receiving (e.g., receiving information), accessing (e.g., accessing data in a memory) and the like. Also, “determining” may include resolving, selecting, choosing, establishing and the like.

The methods disclosed herein comprise one or more steps or actions for achieving the methods. The method steps and/or actions may be interchanged with one another without departing from the scope of the claims. In other words, unless a specific order of steps or actions is specified, the order and/or use of specific steps and/or actions may be modified without departing from the scope of the claims. Further, the various operations of methods described above may be performed by any suitable means capable of performing the corresponding functions. The means may include various hardware and/or software component(s) and/or module(s), including, but not limited to a circuit, an application specific integrated circuit (ASIC), or processor. Generally, where there are operations illustrated in figures, those operations may have corresponding counterpart means-plus-function components with similar numbering.

The various illustrative logical blocks, modules and circuits described in connection with the present disclosure may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device (PLD), discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any commercially available processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.

A processing system may be implemented with a bus architecture. The bus may include any number of interconnecting buses and bridges depending on the specific application of the processing system and the overall design constraints. The bus may link together various circuits including a processor, machine-readable media, and input/output devices, among others. A user interface (e.g., keypad, display, mouse, joystick, etc.) may also be connected to the bus. The bus may also link various other circuits such as timing sources, peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further. The processor may be implemented with one or more general-purpose and/or special-purpose processors. Examples include microprocessors, microcontrollers, DSP processors, and other circuitry that can execute software. Those skilled in the art will recognize how best to implement the described functionality for the processing system depending on the particular application and the overall design constraints imposed on the overall system.

If implemented in software, the functions may be stored or transmitted over as one or more instructions or code on a computer-readable medium. Software shall be construed broadly to mean instructions, data, or any combination thereof, whether referred to as software, firmware, middleware, microcode, hardware description language, or otherwise. Computer-readable media include both computer storage media and communication media, such as any medium that facilitates transfer of a computer program from one place to another. The processor may be responsible for managing the bus and general processing, including the execution of software modules stored on the computer-readable storage media. A computer-readable storage medium may be coupled to a processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. By way of example, the computer-readable media may include a transmission line, a carrier wave modulated by data, and/or a computer readable storage medium with instructions stored thereon separate from the wireless node, all of which may be accessed by the processor through the bus interface. Alternatively, or in addition, the computer-readable media, or any portion thereof, may be integrated into the processor, such as the case may be with cache and/or general register files. Examples of machine-readable storage media may include, by way of example, RAM (Random Access Memory), flash memory, ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), registers, magnetic disks, optical disks, hard drives, or any other suitable storage medium, or any combination thereof. The machine-readable media may be embodied in a computer-program product.

A software module may comprise a single instruction, or many instructions, and may be distributed over several different code segments, among different programs, and across multiple storage media. The computer-readable media may comprise a number of software modules. The software modules include instructions that, when executed by an apparatus such as a processor, cause the processing system to perform various functions. The software modules may include a transmission module and a receiving module. Each software module may reside in a single storage device or be distributed across multiple storage devices. By way of example, a software module may be loaded into RAM from a hard drive when a triggering event occurs. During execution of the software module, the processor may load some of the instructions into cache to increase access speed. One or more cache lines may then be loaded into a general register file for execution by the processor. When referring to the functionality of a software module, it will be understood that such functionality is implemented by the processor when executing instructions from that software module.

The following claims are not intended to be limited to the embodiments shown herein, but are to be accorded the full scope consistent with the language of the claims. Within a claim, reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more.” Unless specifically stated otherwise, the term “some” refers to one or more. No claim element is to be construed under the provisions of 35 U.S.C. § 112(f) unless the element is expressly recited using the phrase “means for” or, in the case of a method claim, the element is recited using the phrase “step for.” All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims. 

What is claimed is:
 1. A method of protecting data in a memory in an electronic device, comprising: storing data in a first memory in the electronic device; determining, via a magnetic sensor, a strength of an ambient magnetic field; comparing the strength of the ambient magnetic field to a threshold; transferring the data in the first memory to a second memory in the electronic device upon determining that the strength of the ambient magnetic field exceeds the threshold; and transferring the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.
 2. The method of claim 1, wherein the first memory is a magnetoresistive random-access memory (MRAM).
 3. The method of claim 2, wherein the second memory is a static random access memory (SRAM).
 4. The method of claim 3, wherein the magnetic sensor is a tunnel-magnetoresistance (TMR) sensor.
 5. The method of claim 4, wherein the first memory is a Spin-Transfer Torque (STT) MRAM.
 6. The method of claim 4, wherein the threshold is in the range of 300 to 500 oersted (Oe).
 7. The method of claim 1, further comprising: accessing the data, via a processor, while the data is stored in the second memory.
 8. The method of claim 1, further comprising: disabling the first memory upon determining that the strength of the ambient magnetic field exceeds the threshold.
 9. An electronic device, comprising: a first memory; a second memory; a magnetic sensor; and a processor in data communication with the first memory, the second memory, and the magnetic sensor and configured to: store data in the first memory; determine, via the magnetic sensor, a strength of an ambient magnetic field; compare the strength of the ambient magnetic field to a threshold; transfer the data in the first memory to a second memory upon determining that the strength of the ambient magnetic field exceeds the threshold; and transfer the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.
 10. The electronic device of claim 9, wherein the first memory is a magnetoresistive random-access memory (MRAM).
 11. The electronic device of claim 10, wherein the second memory is a static random access memory (SRAM).
 12. The electronic device of claim 11, wherein the magnetic sensor is a tunnel-magnetoresistance (TMR) sensor.
 13. The electronic device of claim 12, wherein the first memory is a Spin-Transfer Torque (STT) MRAM.
 14. The electronic device of claim 12, wherein the threshold is in the range of 300 to 500 oersted (Oe).
 15. A non-transitory, computer-readable medium comprising instructions that, when executed by a processor of an electronic device, cause the electronic device to perform a method of protecting data in a memory in an electronic device, the method comprising: storing data in a first memory in the electronic device; determining, via a magnetic sensor, a strength of an ambient magnetic field; comparing the strength of the ambient magnetic field to a threshold; transferring the data in the first memory to a second memory in the electronic device upon determining that the strength of the ambient magnetic field exceeds the threshold; and transferring the data from the second memory to the first memory upon determining that the strength of the ambient magnetic field no longer exceeds the threshold.
 16. The non-transitory computer-readable medium of claim 15, wherein the first memory is a magnetoresistive random-access memory (MRAM).
 17. The non-transitory computer-readable medium of claim 16, wherein the second memory is a static random access memory (SRAM).
 18. The non-transitory computer-readable medium of claim 17, wherein the magnetic sensor is a tunnel-magnetoresistance (TMR) sensor.
 19. The non-transitory computer-readable medium of claim 18, wherein the first memory is a Spin-Transfer Torque (STT) MRAM.
 20. The non-transitory computer-readable medium of claim 18, wherein the threshold is in the range of 300 to 500 oersted (Oe). 